<?php
include("lib/sms_db_connect.php");
$mobile = $_GET['mobile'];
$message = $_GET['message'];

if(substr($mobile,0,3)=='+63')
{
$prefix = substr($mobile,3,3);
$prefix = '0'.$prefix;
}
if(substr($mobile,0,3)!='+63')
{
$prefix = substr($mobile,0,4);
}

$query_dev = "SELECT outbox FROM provider WHERE network LIKE '".$prefix."%'";
$result_dev = mysql_query($query_dev) or die("SELECT DEVICE ID ".mysql_error());
$row_dev = mysql_fetch_array($result_dev);

$device_id = $row_dev["outbox"];

$query_ins = "INSERT INTO smsout (case_num,type,smsto,smsmsg,devid,status) VALUES
('','','".$mobile."', '".$message."', '4','0')";
mysql_query($query_ins) or die("SMS ERROR: ".mysql_error());
?>